extends NodeState


@export var enemy: BasicEnemy


var collectible: Collectible


func _on_enter() -> void:
	collectible = null
	pickup_collectible()


func _on_exit() -> void:
	pass



func pickup_collectible():
	collectible = enemy.try_pickup_collectible()
	if collectible != null:
		enemy.animationPlayer.play(BasicEnemy.ANIMATION_PICKUP)
		enemy.pickup_collectible(collectible)
	else:
		transition_state(BasicEnemy.STATE_IDLE)



func on_pickup_animation_finished():
	transition_state(BasicEnemy.STATE_IDLE)
